//
//  HEHotRecomCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/10/19.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEHotRecomCell.h"

@interface HEHotRecomCell ()

@property (weak, nonatomic) IBOutlet UIImageView *goodImgView;
@property (weak, nonatomic) IBOutlet UILabel *titleLb;
@property (weak, nonatomic) IBOutlet UILabel *priceLb;
@property (weak, nonatomic) IBOutlet UILabel *oldPriceLb;


@end

@implementation HEHotRecomCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.contentView.backgroundColor = KWhiteColor;
    self.contentView.layer.masksToBounds = YES;
    self.contentView.layer.cornerRadius = 6;
    
    _goodImgView.layer.masksToBounds = YES;
    _goodImgView.layer.cornerRadius = 6;
    
    _titleLb.textColor = KHexColor(@"#3A3A3A");
    _priceLb.textColor = KHexColor(@"#FF4D4D");
    _oldPriceLb.textColor = KHexColor(@"#AAAAAA");

    _titleLb.font = DYFont(16);
    _priceLb.font = DYBlodFont(18);
    _oldPriceLb.font = DYFont(14);
    
    _titleLb.numberOfLines = 2;
    
    [_goodImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView);
        make.left.right.equalTo(self.contentView);
        make.height.mas_offset(165);
    }];
    
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_goodImgView.mas_bottom).mas_offset(10);
        make.left.right.equalTo(self.contentView).mas_offset(10);
    }];
    
    [_priceLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLb.mas_bottom).mas_offset(19);
        make.left.equalTo(self.contentView).mas_offset(10);
    }];
    
    [_priceLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];

    
    [_oldPriceLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(_priceLb.mas_bottom);
        make.left.equalTo(_priceLb.mas_right).mas_offset(6);
        make.right.equalTo(self.contentView).mas_offset(10);
    }];
    
  
}

- (void)setModel:(HEGoodsModel *)model {
    _model = model;
    
    [_goodImgView sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:IMAGE_NAMED(@"noImage")];
    _titleLb.text = model.name;
    _priceLb.text = [NSString stringWithFormat:@"￥%@", model.Kprice];

    //中划线
    // 赋值
    _oldPriceLb.attributedText = model.KOrangeprice;
}
 

@end
